package ma.zhiqiang.dataline.core.handler;

import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.ObjUtil;
import ma.zhiqiang.dataline.core.dto.Column;

/**
 * Base64 编码处理类
 */
public class Base64EncodeFieldHandler implements FieldHandler{
    @Override
    public Column handle(Column column) {
        if(null==column|| null==column.getValue()) return column;
        if(column.getValue() instanceof String){
            column.setValue(Base64.encode((String)column.getValue()));
        }
        return column;
    }

    @Override
    public String handle(String value) {
        return Base64.encode(value);
    }
}
